package org.huatek.anders.config;

import org.huatek.anders.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author anders
 * @date 2018-12-05 17:52
 * token拦截器
 **/
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {
    private final TokenInterceptor tokenInterceptor;
    @Autowired
    public InterceptorConfig(TokenInterceptor tokenInterceptor){
        this.tokenInterceptor = tokenInterceptor;
    }
    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor);
        super.addInterceptors(registry);
    }
}
